package cn.mysdp.biz.controller;


import cn.mysdp.biz.controller.*;
import cn.mysdp.biz.dto.request.*;
import cn.mysdp.biz.dto.response.*;

import java.util.List;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: SdpWorkspaceConfigWebController
 * @Description:
 * @Author: SDP
 * @Date: 2021-10-30
 * @Version: 1.0
 * Table: sdp_workspace_config
 * Comment:
 * 
 */
@RestController
@RequestMapping(value = "/sdp_workspace_config")
public class SdpWorkspaceConfigWebController extends SdpWorkspaceConfigWebCustomController {
    static {
        addRequestClass("sdp_workspace_config", "add", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigAddRequest.class);
        addRequestClass("sdp_workspace_config", "add_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigAddRequest.class);

        addRequestClass("sdp_workspace_config", "update", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigUpdateRequest.class);
        addRequestClass("sdp_workspace_config", "update_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigUpdateRequest.class);

        addRequestClass("sdp_workspace_config", "delete", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigDeleteRequest.class);
        addRequestClass("sdp_workspace_config", "delete_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigDeleteRequest.class);

        addRequestClass("sdp_workspace_config", "query", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);
        addRequestClass("sdp_workspace_config", "query_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);

        addRequestClass("sdp_workspace_config", "list", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);
        addRequestClass("sdp_workspace_config", "list_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);

        addRequestClass("sdp_workspace_config", "count", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);
        addRequestClass("sdp_workspace_config", "count_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);

        addRequestClass("sdp_workspace_config", "stat", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);
        addRequestClass("sdp_workspace_config", "stat_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigQueryRequest.class);

    }

    @PostMapping("/add")
    public Integer addSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigAddRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "add", request, callFromEncrypt);
        return super.addSdpWorkspaceConfig(request);
    }

    @PostMapping("/add_encrypt")
    public String addSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigAddRequest request = (SdpWorkspaceConfigAddRequest) super.decrypt("sdp_workspace_config", "add_encrypt", strRequest, SdpWorkspaceConfigAddRequest.class);
        Integer result = addSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/update")
    public Integer updateSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigUpdateRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "update", request, callFromEncrypt);
        return super.updateSdpWorkspaceConfig(request);
    }

    @PostMapping("/update_encrypt")
    public String updateSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigUpdateRequest request = (SdpWorkspaceConfigUpdateRequest) super.decrypt("sdp_workspace_config", "update_encrypt", strRequest, SdpWorkspaceConfigUpdateRequest.class);
        Integer result = updateSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/delete")
    public Integer deleteSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigDeleteRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "delete", request, callFromEncrypt);
        return super.deleteSdpWorkspaceConfig(request);
    }

    @PostMapping("/delete_encrypt")
    public String deleteSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigDeleteRequest request = (SdpWorkspaceConfigDeleteRequest) super.decrypt("sdp_workspace_config", "delete_encrypt", strRequest, SdpWorkspaceConfigDeleteRequest.class);
        Integer result = deleteSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/query")
    public SdpWorkspaceConfigQueryResponse querySdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_workspace_config", "query", request, callFromEncrypt);
      SdpWorkspaceConfigQueryResponse result = super.querySdpWorkspaceConfig(request);
      super.fixResult("sdp_workspace_config", "query", request);
      return result;
    }

    @PostMapping("/query_encrypt")
    public String querySdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigQueryRequest request = (SdpWorkspaceConfigQueryRequest) super.decrypt("sdp_workspace_config", "query_encrypt", strRequest, SdpWorkspaceConfigQueryRequest.class);
        SdpWorkspaceConfigQueryResponse result = querySdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/list")
    public List<SdpWorkspaceConfigQueryResponse> listSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "list", request, callFromEncrypt);
        List<SdpWorkspaceConfigQueryResponse> list = super.listSdpWorkspaceConfig(request);
        super.fixResult("sdp_workspace_config", "list", list);
        return list;
    }

    @PostMapping("/list_encrypt")
    public String listSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigQueryRequest request = (SdpWorkspaceConfigQueryRequest) super.decrypt("sdp_workspace_config", "list_encrypt", strRequest, SdpWorkspaceConfigQueryRequest.class);
        List<SdpWorkspaceConfigQueryResponse> result = listSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/count")
    public Integer countSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_workspace_config", "count", request, callFromEncrypt);
      return super.countSdpWorkspaceConfig(request);
    }


    @PostMapping("/count_encrypt")
    public String countSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigQueryRequest request = (SdpWorkspaceConfigQueryRequest) super.decrypt("sdp_workspace_config", "count_encrypt", strRequest, SdpWorkspaceConfigQueryRequest.class);
        Integer result = countSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/stat")
    public BaseStatResponse statSdpWorkspaceConfig(@RequestBody SdpWorkspaceConfigQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "stat", request, callFromEncrypt);
        return super.statSdpWorkspaceConfig(request);
    }

    @PostMapping("/stat_encrypt")
    public String statSdpWorkspaceConfigEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigQueryRequest request = (SdpWorkspaceConfigQueryRequest) super.decrypt("sdp_workspace_config", "stat_encrypt", strRequest, SdpWorkspaceConfigQueryRequest.class);
        BaseStatResponse result = statSdpWorkspaceConfig(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }


    static {
        addRequestClass("sdp_workspace_config", "batch_update_value", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigAddRequest.class);
        addRequestClass("sdp_workspace_config", "batch_update_value_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, SdpWorkspaceConfigAddRequest.class);
    }
    
    @ResponseBody
    @PostMapping("/batch_update_value")
    public Integer batchUpdateValue(@RequestBody SdpWorkspaceConfigAddRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "batch_update_value", request, callFromEncrypt);
        Integer result = super.batchUpdateValue(request);
        super.fixResult("sdp_workspace_config", "batch_update_value", request);
        return result;
    }

    @ResponseBody
    @PostMapping("/batch_update_value_encrypt")
    public String batchUpdateValueEncrypt(@RequestBody String strRequest) throws Exception {
        SdpWorkspaceConfigAddRequest request = (SdpWorkspaceConfigAddRequest)decrypt("sdp_workspace_config", "batch_update_value_encrypt", strRequest, SdpWorkspaceConfigAddRequest.class);
        Integer result = batchUpdateValue(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }

    static {
        addRequestClass("sdp_workspace_config", "clone", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, BaseNameIdRequest.class);
        addRequestClass("sdp_workspace_config", "clone_encrypt", "sdpWorkspaceConfigController", SdpWorkspaceConfigWebController.class, BaseNameIdRequest.class);
    }
    
    @ResponseBody
    @PostMapping("/clone")
    public Integer clone(@RequestBody BaseNameIdRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_workspace_config", "clone", request, callFromEncrypt);
        Integer result = super.clone(request);
        super.fixResult("sdp_workspace_config", "clone", request);
        return result;
    }

    @ResponseBody
    @PostMapping("/clone_encrypt")
    public String cloneEncrypt(@RequestBody String strRequest) throws Exception {
        BaseNameIdRequest request = (BaseNameIdRequest)decrypt("sdp_workspace_config", "clone_encrypt", strRequest, BaseNameIdRequest.class);
        Integer result = clone(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }

}
